import java.io.*;
import java.net.*;

public class SimpleSocketClient {
    public static void main(String[] args) {
        Socket socket = null;
        InputStream is = null;
        OutputStream os = null;
        String serverIP = "127.0.0.1";
        int port = 10001;
        String data = "Hello";
        try {
            socket = new Socket(serverIP, port);
            os = socket.getOutputStream();
            os.write(data.getBytes());
            is = socket.getInputStream();
            byte[] b = new byte[1024];
            int n = is.read(b);
            System.out.println("Feedback from Server:\t" + new String(b, 0, n));
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                is.close();
                os.close();
                socket.close();
            } catch (Exception e2) {}
        }
    }
}
